<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>编辑直播记录</title>
    <link href="${base}/resources/admin/css/amazeui.css" rel="stylesheet" type="text/css" />
    <link href="${base}/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
</head>
<style type="text/css">
    .cover{
        cursor: pointer;
    }
    .fens div{
        float: left;
        margin: 5px;
        border: 1px solid rgba(86, 86, 86, 0.4);
        border-radius: 5px;
        padding: 5px;
        line-height: 20px;
        background: rgba(86, 86, 86, 0.04) !important;
    }
    .fens div img{
        width: 40px;
        height:40px;
    }
    /*.fens div a{*/

    /*}*/
</style>
<body>
<div class="path">
    <a href="${base}/asl-admin/common/index.htm">${message("admin.path.index")}</a> &raquo; 编辑直播记录
</div>
[#--禁播表单--]
<form id="forbiddenForm" action="forbidden.htm" method="get">
    <input type="hidden" name="id" value="${live.id}"/>
</form>
<form id="inputForm" action="update.htm" method="post">
    <input type="hidden" name="id" value="${live.id}"/>
    <table class="input">
        <tr>
            <th>
                标题:
            </th>
            <td colspan="4">
                [#if live.course??]
                    ${live.course.title}
                [/#if]
            </td>
        </tr>
        <tr>
            <th>
                直播封面:
            </th>
            <td colspan="4">
                <span class="fieldSet">
                [#if live.course??]
                    <img src="${live.course.imageURL}" alt="" width="80px" height="40px" class="cover"/>
                [/#if]
                </span>
            </td>
        </tr>
        <tr>
            <th>
                <span class="requiredField"></span>用户名:
            </th>
            <td colspan="4">
                [#if live.anchor??]
                ${live.anchor.username}(${live.anchor.name!'-'})
                [/#if]
            </td>
        </tr>

        [#if live.mp4URL??]
            [#list live.mp4URL?split('!!') as mp4]
                <tr>
                    <th>
                        回看视频${mp4_index+1}:
                    </th>
                    <td>
                        <a href="${mp4}" target="_blank">${live.title}(${mp4_index+1})</a>
                    </td>
                </tr>
            [/#list]
        [/#if]
        <tr>
            <th>
                <span class="requiredField"></span>直播时长:
            </th>
            <td colspan="4">
                ${live.timeSpanChinese}
            </td>
        </tr>
        <tr>
            <th>
                <span class="requiredField"></span>直播状态:
            </th>
            <td colspan="4">
                <input type="hidden" name="liveStatus" class="text" value="${live.liveStatus}"/>
            [#if live.liveStatus=="nolive"]
                <span class="am-badge am-badge-primary am-radius">${message("Live.LiveStatus." + live.liveStatus)}</span>
            [#elseif live.liveStatus=="live"]
                <span class="am-badge am-badge-secondary am-radius">${message("Live.LiveStatus." + live.liveStatus)}</span>
            [#elseif live.liveStatus=="finished"]
                <span class="am-badge am-badge-success am-radius">${message("Live.LiveStatus." + live.liveStatus)}</span>
            [#else ]
                <span class="am-badge am-badge-danger am-radius">${message("Live.LiveStatus." + live.liveStatus)}</span>
            [/#if]
                [#--<span class="am-badge am-badge-success am-radius">${message("Live.LiveStatus." + live.liveStatus)}</span>--]
                [#--<input type="button" id="forbiddenButton" class="button"--]
                       [#--value="${message("Live.LiveStatus.forbidden")}"--]
                [#--[#if live.liveStatus == "forbidden" ] disabled="disabled"[/#if]/>--]
            </td>
        </tr>
        <tr>
            <th>
                添加机器人数:
            </th>
            <td>
                <input type="text" name="number", class="text" placeholder="请输入要添加的机器人数,一次最多200">
            </td>
        </tr>
        <tr>
            <th>
                <span class="requiredField"></span>实时观看人数:
            </th>
            <td colspan="4">
            ${live.watchCountWithoutRobot}
            </td>
        </tr>
        <tr>
            <th>
                实时观看用户:
            </th>
            <td class="fens">
            [#if watchingMembers??]
                [#list watchingMembers as watchingMember]
                    <div>
                        <img src="${(watchingMember.avator)!"/resources/admin/images/avator.png"}" class="am-circle" />
                        <a>${watchingMember.username}(${watchingMember.name})</a>
                    </div>
                [/#list]
            [/#if]
            </td>
        </tr>
        <tr>
            <th>
                历史观看人数:
            </th>
            <td colspan="4">
                ${live.hisWatchCountWithoutRobot}
            </td>
        </tr>
        <tr>
        <th>
            历史观看用户:
        </th>
        <td class="fens">
        [#if members??]
            [#list members as member]
            <div>
                <img src="${(member.avator)!"/resources/admin/images/avator.png"}" class="am-circle" />
                <a>${member.username}(${member.name})</a>
            </div>
            [/#list]
        [/#if]
        </td>
        </tr>
        <tr>
            <th>
                机器人数(${live.hisWatchRobotCount}):
            </th>
            <td class="fens">
            [#if robots??]
                [#list robots as robot]
                    <div>
                        <img src="${(robot.avator)!"/resources/admin/images/avator.png"}" class="am-circle" />
                        <a>${robot.name}</a>
                    </div>
                [/#list]
            [/#if]
            </td>
        </tr>
        <tr>
            <th>
                &nbsp;
            </th>
            <td>
                <input type="submit" class="button" value="${message("admin.common.submit")}"/>
                <input type="button" class="button" value="${message("admin.common.back")}"
                       onclick="location.href='list.htm'"/>
            </td>
        </tr>
    </table>
</form>
</body>
<script type="text/javascript" src="${base}/resources/admin/js/jquery.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/jquery.validate.js"></script>
<script type="text/javascript" src="${base}/resources/admin/editor/kindeditor.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/common.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/input.js"></script>
<script type="text/javascript">
    $().ready(function () {

        var $inputForm = $("#inputForm");
        var $browserButton = $("#browserButton");
        var $forbiddenButton = $("#forbiddenButton");
        var $forbiddenForm = $("#forbiddenForm");


        $(".cover").on("click", function(){
            window.open($(this).attr("src"));
        })

    [@flash_message /]

        $browserButton.browser();

        // 表单验证
        $inputForm.validate({
            rules: {
                title: "required",
                cover: "required",
                number:{
                    digits: true,
                    min:0,
                    max:200
                }
            }
        });

        // 禁播
        $forbiddenButton.click(function () {
            var $this = $(this);
            $.dialog({
                type: "warn",
                content: "禁播后将无法恢复，是否继续?",
                onOk: function () {
                    $forbiddenForm.submit();
                }
            });
        });

    });
</script>
</html>
